package adapter;

import android.content.Context;
import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import bean.PrePareBeans;
import student.andlei.com.student.R;
import utils.StringUtils;

public class ReViewAdapter extends BaseQuickAdapter<PrePareBeans.mlist,BaseViewHolder>{

    private Context context;
    public ReViewAdapter(Context context, int layoutResId, @Nullable List data) {
        super(layoutResId, data);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, PrePareBeans.mlist item) {

        helper.setText(R.id.tv_week, StringUtils.isNull(item.week)?"":item.week);
        helper.setText(R.id.tv_date, StringUtils.isNull(item.room_date)?"":item.room_date);
        helper.setText(R.id.tv_time, StringUtils.isNull(item.start_time)?"":(item.start_time+"---"+item.end_time));
        helper.setText(R.id.tv_subject, StringUtils.isNull(item.room_name)?"":item.room_name);
        helper.setText(R.id.tv_teacher, StringUtils.isNull(item.teacher_name)?"":item.teacher_name+"老师");
//        if(item.bag_id.trim().equals("0")){
//            helper.getView(R.id.bt_review).setVisibility(View.VISIBLE);
//        }else {
//            helper.getView(R.id.bt_review).setVisibility(View.GONE);
//        }
        helper.addOnClickListener(R.id.bt_review);
        helper.addOnClickListener(R.id.bt_look);
        switch (item.classroom_status){
            case 3:
                helper.setText(R.id.bt_look, "查看录播").setBackgroundRes(R.id.bt_look,R.drawable.bt_click);
                break;
            case 4:
                helper.setText(R.id.bt_look, "查看录播").setBackgroundRes(R.id.bt_look,R.drawable.bt_click);
                break;
        }
        if(helper.getLayoutPosition()%2==0){
            helper.getView(R.id.Rly_bg).setBackgroundResource(R.color.item_bg);
        }else {
            helper.getView(R.id.Rly_bg).setBackgroundResource(R.color.appstyletitlecolor);
        }

    }


}
